﻿//Created by Action Script Viewer - http://www.buraks.com/asv
package Classes.actions {
    import Classes.*;
    import Classes.util.*;
    import Classes.effects.*;

    public class ActionAnimationEffect extends NPCAction {

        protected var m_effect:AnimationEffect;
        protected var m_effectType:EffectType;

        public function ActionAnimationEffect(_arg1:NPC, _arg2:EffectType){
            super(_arg1);
            this.m_effect = null;
            this.m_effectType = _arg2;
        }
        override public function enter():void{
            super.enter();
            this.startEffect();
        }
        override public function reenter():void{
            super.reenter();
            this.startEffect();
        }
        override public function update(_arg1:Number):void{
            super.update(_arg1);
            if (!m_npc.isVisible()){
                this.m_effect.cleanUp();
                m_npc.alpha = 1;
                m_npc.getStateMachine().removeState(this);
                return;
            };
            if (((!(this.m_effect)) || (this.m_effect.isComplete()))){
                m_npc.getStateMachine().removeState(this);
            };
        }
        protected function startEffect():void{
            var _local1:MapResourceEffect = m_npc.addAnimatedEffect(this.m_effectType);
            if ((_local1 is AnimationEffect)){
                this.m_effect = (_local1 as AnimationEffect);
                if ((((this.m_effectType == EffectType.VEHICLE_POOF)) || ((this.m_effectType == EffectType.POOF)))){
                    Sounds.play("poof");
                };
            };
        }

    }
}//package Classes.actions 
